package com.gameguru.mathgame;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;

public class MathGame extends Activity {

	private Intent intent;
	private int actionCode;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}

	public void onAddButtonClick(View view) {
		startCountDown(1);

		// startActivity(new Intent(Constants.ADD_ACTION));
	}

	public void onSubButtonClick(View view) {
		startCountDown(2);
		// startActivity(new Intent(Constants.SUB_ACTION));
	}

	public void onSettingsButtonClick(View view) {
		startActivity(new Intent().setAction(Constants.SETTINGS_ACTION));
	}

	public void onExitButtonClick(View view) {
		this.finish();
	}

	public void onHelpButtonClick(View view) {
		startActivity(new Intent(this, HelpActivity.class));
	}

	public void onReportButtonClick(View view) {
		startActivity(new Intent(this, ShowChart.class));
	}

	public void startCountDown(int actionCode) {
		this.actionCode = actionCode;
		intent = new Intent();
		intent.setAction(Constants.START_COUNTER_ACTION);
		int requestCode = 10;
		startActivityForResult(intent, requestCode);

	}

	public void onActivityResult(int regCode, int resCode, Intent intent) {
		super.onActivityResult(regCode, resCode, intent);

		switch (actionCode) {
		case 1:
			startActivity(new Intent(Constants.ADD_ACTION));
			break;
		case 2:
			startActivity(new Intent(Constants.SUB_ACTION));
			break;
		}

	}

}
